package com.blood.core.resp;


/**
 * @author yelong
 * @version 1.0
 * @date 2020/8/12 15:35
 * @description 业务异常封装
 */
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = -5875371379845226068L;

    /**
     * 异常信息
     */
    private String errorMsg;

    /**
     * 返回代码
     */
    private String errorCode;

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }


    public BusinessException(String errMsg) {
        super(errMsg);
        this.setErrorMsg(errMsg);
    }

    public BusinessException(GlobalResultStatus status) {
        super(status.getMessage());
        this.setErrorMsg(status.getMessage());
        this.setErrorCode(status.getCode());
    }


    public BusinessException(GlobalResultStatus status, String errMsg) {
        super(errMsg);
        this.setErrorMsg(errMsg);
        this.setErrorCode(status.getCode());
    }

}